<?php
html::printPath(array('personTag.form-title' => 'admin/personTag/all', 'application.page-title-display' => ''));
$msg->printMessages();

echo html::entityInfoIcon('person_tag', $personTag, 'id');
?>

<ul class="commandList">
    <li class="editLi"><?php echo html::anchor('admin/personTag/edit?id=' . $personTag['id'], text::get('personTag.editThis')) ?></li>
    <?php
    // If the tag has a code, it is important for the system to work -> it cannot be deleted.
    if (! $personTag['code']) {
        echo '<li class="deleteLi">' . html::anchor('admin/personTag/delete?id=' . $personTag['id'], text::get('personTag.deleteThis'), array('onclick'=>'return confirmDeletion()')) . '</li>';
    }
    ?>
</ul>

<?php
$fb = new FormBuilder('personTag', $personTag);
$fb->displayOnly();
$fb->text('name');
$fb->textarea('description');
$fb->write();

echo '<h3>' . text::getEscaped('personTag.addPerson') . '</h3>';

$fb = new FormBuilder('person', $formData);
$fb->setAction('/admin/personTag/addPerson');
$fb->hidden('id');
$fb->autocompleter('person_id', $personOptions)->mustMatch()->labelKey('personTag.person_id');
// $fb->submitButton('button.add');
$fb->write();

if ($personList) {
    echo '<h2>' . text::getEscaped('personTag.personsWithThisTag') . '</h2>';
    $elb = new EntityListBuilder('person', $personList);
    $elb->setUuid($this->DISPLAY_PERSON_LIST_UUID);
    $elb->text('last_name')->openInPopup();
    $elb->text('first_name');
    $elb->date('birth_date');
    $elb->write();
}
